﻿/********************************************************* 
 * 某些处理节点中会依据具体情况有不同的特定操作（如归档，分发等不在模版定义里的方法）,需要通过本接口定义
 *    
 *********************************************************/

using Abp.Dependency;
using Mt.Site.Core.Organizations.UserCache.Models;
using Mt.Site.Core.WorkFlows.Process;
using Mt.Site.Core.WorkFlows.Process.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Mt.Site.Core.WorkFlows
{
    /// <summary>
    /// 自定义操作
    /// </summary>
    public interface IAction : ITransientDependency
    {
        Task<string> DisplayName(IWorkFlowManager manager);

        string UniqueName { get; }

        /// <summary>
        /// 是否显示该操作按钮（当前用户是否有操作权限）
        /// </summary>
        /// <param name="manager"></param>
        /// <returns></returns>
        Task<bool> IsShowAsync(IWorkFlowManager manager);

        /// <summary>
        /// 操作处理
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="args">参数</param>
        Task OperateAsync(IWorkFlowManager manager, object args);

        /// <summary>
        /// 是否需要弹出人员选择框
        /// </summary>
        bool NeedUserListArg { get; }

        /// <summary>
        /// 这个字段目前没有使用
        /// </summary>
        bool NeedReply(IWorkFlowManager manager);

        /// <summary>
        /// 调用前端js
        /// </summary>
        string JsActionName { get; }

        /// <summary>
        /// 操作执行成功后的回调函数
        /// </summary>
        string JsOnSuccessActionName { get; }

        /// <summary>
        /// 待选人员
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="nodeId"></param>
        /// <param name="unitId"></param>
        /// <returns></returns>
        Task<GetUserSelectionDataOutput> GetUserListAsync(IWorkFlowManager manager,  Guid? nodeId, List<long> unitId);

        bool NeedCheckState { get; }

        Task<StateWhenSubmit> CheckStateBeforeActionAsync(IWorkFlowManager workFlowManager, object param);
    }
}
